package com.lagou.Client;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.InetAddress;
import java.net.Socket;

public class ClientInitClose {
    private Socket s=null;
    private ObjectInputStream ois;
    private ObjectOutputStream oos;

    public ObjectInputStream getOis() {
        return ois;
    }

    public ObjectOutputStream getOos() {
        return oos;
    }

    public void ClientInit() throws IOException {
        Socket s=new Socket(InetAddress.getLocalHost(),6666);
        oos=new ObjectOutputStream(s.getOutputStream());
        ois=new ObjectInputStream(s.getInputStream());
        System.out.println("连接服务器成功!");
    }

    public void ClientClose() throws IOException {
        ois.close();
        oos.close();
        if(null!=s) {
            s.close();
        }
    }
}
